package com.bcnapps.DemoGame;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.ImageButton;

public class MainPage extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.mainpage);
		GV.Instancies.background = (Background) findViewById(R.id.background_bma);
		ImageButton playone = (ImageButton) findViewById(R.id.mainibplayone);
		playone.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent i = new Intent("com.bcnapps.DemoGame.GAMEONELAYOUT");
				startActivity(i);
			}
		});
		ImageButton playtwo = (ImageButton) findViewById(R.id.mainibplaytwo);
		playtwo.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent i = new Intent("com.bcnapps.DemoGame.GAMETWOLAYOUT");
				startActivity(i);
			}
		});
		
		ImageButton playthree = (ImageButton) findViewById(R.id.mainibplaythree);
		playthree.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent i = new Intent("com.bcnapps.DemoGame.GAMETHREELAYOUT");
				startActivity(i);
			}
		});
	}

	@Override
	protected void onPause() {
		GV.Instancies.background.stopthread();
		super.onPause();
	}

	@Override
	protected void onResume() {
		GV.Screen.metrics = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics(GV.Screen.metrics);
		GV.Instancies.background.startthread();
		super.onResume();
	}
	
	@Override
	public void onBackPressed() {
		finish();
		//activity transition animation
		super.onBackPressed();
	}
}
